package com.bazinga.contact.view;

import java.util.Map;

import org.apache.struts2.dispatcher.SessionMap;
import org.apache.struts2.interceptor.SessionAware;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;


public class LogoutAction extends ActionSupport implements SessionAware {
	private static final long serialVersionUID = 1L;
	private Map<String, Object> session;
       
	public String execute() {
		this.session = ActionContext.getContext().getSession();
		session.remove("logged-in");
		session.remove("username");
		session.remove("firstname");
		session.remove("userid");
		session.remove("usertype");
		((SessionMap<String, Object>)this.session).invalidate();
		return "logout";
	}
    public LogoutAction() {
        super();
        // TODO Auto-generated constructor stub
    }

	@Override
	public void setSession(Map<String, Object> session) {
		// TODO Auto-generated method stub
		this.session = session;
	}
}
